/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jl.tools.stkeditor.command;

import java.util.Stack;

/**
 *
 * @author Administrator
 */
public class CmdUndoManager {

  private final Stack<Command> stack = new Stack<Command>();

  public void add(Command cmd) {
    stack.push(cmd);
  }

  public boolean canUndo() {
    return !stack.isEmpty();
  }

  public void undo() {
    Command cmd = stack.pop();
    cmd.undo();
  }
}
